package com.mjh.action;
/*
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionContext;*/
import org.apache.log4j.Logger;
import com.opensymphony.xwork2.ActionSupport;
import com.mjh.bean.Picture;
import com.mjh.manager.PictureManager;

public class PictureAction extends ActionSupport{

	private static final long serialVersionUID = -5969814568349114819L;
	
	public static Logger log = Logger.getLogger(PictureAction.class);
	
	private PictureManager manager = new PictureManager();
	
	private Picture picture;
	
	/*	ActionContext context = ActionContext.getContext();
    Map requestm = (Map)context.get("request");
    Map sessionm = context.getSession();
    Map applicationm = context.getApplication();
	HttpServletRequest request = ServletActionContext.getRequest ();
	ActionContext ct= ActionContext.getContext();
	HttpServletRequest request2=(HttpServletRequest)ct.get(ServletActionContext.HTTP_REQUEST);
	HttpServletRequest request3 = ServletActionContext.getRequest();
	HttpServletResponse response = ServletActionContext.getResponse();
	HttpSession session = request.getSession();
*/	
	
	
	
	public String add(){
		this.picture = new Picture();
		picture.setPicTitle("long  llllllllllllllllll   文章");
		log.info("add a picture ===================");
		manager.addPicture(this.picture);
		return SUCCESS;
	}
	
	public String del(){
		return SUCCESS;
	}
	
	public String get(){
		Picture picture = manager.getPicture(new Integer(1));
		log.info("picture title is " + picture.getPicTitle());
		return SUCCESS;
	}
	
	public String list(){
		return SUCCESS;
	}

	public Picture getPicture() {
		return picture;
	}

	public void setPicture(Picture picture) {
		this.picture = picture;
	}
	
}
